import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import Message from '../views/Message.vue'
import Admin from '../views/Admin.vue'
import Barter from '../views/Barter.vue'
import Mine from '../views/Mine.vue'
import SameWay from '../views/SameWay.vue'
import Share from '../views/Share.vue'
import Take from '../views/Take.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home/barter',
  }, {
    path: '/login',
    component: Login
  },
  {
    path: '/home',
    name: 'home',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    // component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    component:Home,
    children:[
      {
        path: 'message',//留言板
        name: 'message',
        component: Message
      },{
        path: 'admin',//管理员
        name: 'admin',
        component: Admin
      },,{
        path: 'barter',//寻物与出物
        name: 'barter',
        component: Barter
      },,{
        path: 'mine',//我的
        name: 'mine',
        component: Mine
      },,{
        path: 'sameway',///同程
        name: 'sameway',
        component: SameWay
      },,{
        path: 'share',//分享
        name: 'share',
        component: Share
      },,{
        path: 'take',//代取东西
        name: 'take',
        component: Take
      },
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
